Turn off prelighting when gtk-touchscreen-mode is enabled (#135666)
authorRoss Burton <ross@openedhand.com>
Thu, 9 Mar 2006 18:48:38 +0000 (18:48 +0000)
committerRoss Burton <rburton@src.gnome.org>
Thu, 9 Mar 2006 18:48:38 +0000 (18:48 +0000)
2006-03-09  Ross Burton  <ross@openedhand.com>

* gtk/gtkwidget.c:
* gtk/gtkrange.c:
* gtk/gtktogglebutton.c:
Turn off prelighting when gtk-touchscreen-mode is enabled (#135666)

ChangeLog
ChangeLog.pre-2-10
gtk/gtkrange.c
gtk/gtktogglebutton.c
gtk/gtkwidget.c

index b56c639e9b00db44438305f0443a00a9997bd7fc..9837c110d5b7dd93f6893db79434acd5100eac12 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-03-09  Ross Burton  <ross@openedhand.com>
+
+       * gtk/gtkwidget.c:
+       * gtk/gtkrange.c:
+       * gtk/gtktogglebutton.c:
+       Turn off prelighting when gtk-touchscreen-mode is enabled (#135666)
+
 Thu Mar  9 14:29:43 2006  Tim Janik  <timj@gtk.org>
 
        * gtk/gtkobject.c (gtk_object_init): move the floating flag from
index b56c639e9b00db44438305f0443a00a9997bd7fc..9837c110d5b7dd93f6893db79434acd5100eac12 100644 (file)
@@ -1,3 +1,10 @@
+2006-03-09  Ross Burton  <ross@openedhand.com>
+
+       * gtk/gtkwidget.c:
+       * gtk/gtkrange.c:
+       * gtk/gtktogglebutton.c:
+       Turn off prelighting when gtk-touchscreen-mode is enabled (#135666)
+
 Thu Mar  9 14:29:43 2006  Tim Janik  <timj@gtk.org>
 
        * gtk/gtkobject.c (gtk_object_init): move the floating flag from
index eb39e10d1577d9161b7be09239229cf9f1cbfaa2..c3cdf88f66172811032fc44a922c58ea8034a5d6 100644 (file)
@@ -1153,6 +1153,11 @@ gtk_range_expose (GtkWidget      *widget,
   GdkRectangle area;
   gint focus_line_width = 0;
   gint focus_padding = 0;
+  gboolean touchscreen;
+
+  g_object_get (gtk_widget_get_settings (widget),
+                "gtk-touchscreen-mode", &touchscreen,
+                NULL);
 
   range = GTK_RANGE (widget);
 
@@ -1208,7 +1213,7 @@ gtk_range_expose (GtkWidget      *widget,
 
   if (!sensitive)
     state = GTK_STATE_INSENSITIVE;
-  else if (range->layout->mouse_location == MOUSE_SLIDER)
+  else if (!touchscreen && range->layout->mouse_location == MOUSE_SLIDER)
     state = GTK_STATE_PRELIGHT;
   else
     state = GTK_STATE_NORMAL;
@@ -1238,28 +1243,28 @@ gtk_range_expose (GtkWidget      *widget,
     draw_stepper (range, &range->layout->stepper_a,
                   range->orientation == GTK_ORIENTATION_VERTICAL ? GTK_ARROW_UP : GTK_ARROW_LEFT,
                   range->layout->grab_location == MOUSE_STEPPER_A,
-                  range->layout->mouse_location == MOUSE_STEPPER_A,
+                  !touchscreen && range->layout->mouse_location == MOUSE_STEPPER_A,
                   &expose_area);
 
   if (range->has_stepper_b)
     draw_stepper (range, &range->layout->stepper_b,
                   range->orientation == GTK_ORIENTATION_VERTICAL ? GTK_ARROW_DOWN : GTK_ARROW_RIGHT,
                   range->layout->grab_location == MOUSE_STEPPER_B,
-                  range->layout->mouse_location == MOUSE_STEPPER_B,
+                  !touchscreen && range->layout->mouse_location == MOUSE_STEPPER_B,
                   &expose_area);
 
   if (range->has_stepper_c)
     draw_stepper (range, &range->layout->stepper_c,
                   range->orientation == GTK_ORIENTATION_VERTICAL ? GTK_ARROW_UP : GTK_ARROW_LEFT,
                   range->layout->grab_location == MOUSE_STEPPER_C,
-                  range->layout->mouse_location == MOUSE_STEPPER_C,
+                  !touchscreen && range->layout->mouse_location == MOUSE_STEPPER_C,
                   &expose_area);
 
   if (range->has_stepper_d)
     draw_stepper (range, &range->layout->stepper_d,
                   range->orientation == GTK_ORIENTATION_VERTICAL ? GTK_ARROW_DOWN : GTK_ARROW_RIGHT,
                   range->layout->grab_location == MOUSE_STEPPER_D,
-                  range->layout->mouse_location == MOUSE_STEPPER_D,
+                  !touchscreen && range->layout->mouse_location == MOUSE_STEPPER_D,
                   &expose_area);
   
   return FALSE;
index a850f3d5b42b6d5e17c4949b9d4609671e65ef78..5552ec3a633c93d37e2b773cc33b36449f45ed36 100644 (file)
@@ -483,9 +483,13 @@ static void
 gtk_toggle_button_update_state (GtkButton *button)
 {
   GtkToggleButton *toggle_button = GTK_TOGGLE_BUTTON (button);
-  gboolean depressed;
+  gboolean depressed, touchscreen;
   GtkStateType new_state;
 
+  g_object_get (gtk_widget_get_settings (GTK_WIDGET (button)),
+                "gtk-touchscreen-mode", &touchscreen,
+                NULL);
+
   if (toggle_button->inconsistent)
     depressed = FALSE;
   else if (button->in_button && button->button_down)
@@ -493,7 +497,7 @@ gtk_toggle_button_update_state (GtkButton *button)
   else
     depressed = toggle_button->active;
       
-  if (button->in_button && (!button->button_down || toggle_button->draw_indicator))
+  if (!touchscreen && button->in_button && (!button->button_down || toggle_button->draw_indicator))
     new_state = GTK_STATE_PRELIGHT;
   else
     new_state = depressed ? GTK_STATE_ACTIVE : GTK_STATE_NORMAL;
index 2872df9327d0996a4219b6f581b7d554e725592f..d7687ddef430be5b2b907656fbf1a28e7758ea3c 100644 (file)
@@ -4317,11 +4317,20 @@ void
 gtk_widget_set_state (GtkWidget           *widget,
                      GtkStateType         state)
 {
+  gboolean touchscreen;
+
   g_return_if_fail (GTK_IS_WIDGET (widget));
 
   if (state == GTK_WIDGET_STATE (widget))
     return;
 
+  g_object_get (gtk_widget_get_settings (widget),
+                "gtk-touchscreen-mode", &touchscreen,
+                NULL);
+  
+  if (touchscreen && state == GTK_STATE_PRELIGHT)
+    state = GTK_STATE_NORMAL;
+
   if (state == GTK_STATE_INSENSITIVE)
     gtk_widget_set_sensitive (widget, FALSE);
   else